<p class="Paragraph">Returns the next available file number for opening a file. This is useful if you want to open a file in addition to other open files and want to ensure that the file number is not already in use.</p>
<p class="Paragraph">This function should be used immediately before an Open statement. FreeFile returns the next available file number, but does not reserve it.</p>
<p class="P2">Example:</p>
<p class="PropText">Sub ExampleWorkWithAFile</p>
<p class="PropText">Dim iNumber As Integer</p>
<p class="PropText">Dim sZeile As String</p>
<p class="PropText">Dim aFile As String</p>
<p class="PropText">Dim sMsg as String</p>
<p class="PropText">aFile = "c:\data.txt"</p>
<p class="PropText">sMsg = = ""</p>
<p class="PropText">iNumber = Freefile</p>
<p class="PropText">Open aFile For Output As #iNumber</p>
<p class="PropText">Print #iNumber, "First line of text"</p>
<p class="PropText">Print #iNumber, "Another line of text"</p>
<p class="PropText">Close #iNumber</p>
<p class="PropText"/>
<p class="PropText">iNumber = Freefile</p>
<p class="PropText">Open aFile For Input As #iNumber</p>